from import_export.widgets import ForeignKeyWidget
from apps.rms.models import PacketType


class PacketTypeForeignKeyWidget(ForeignKeyWidget):
    def get_queryset(self, value, row, *args, **kwargs):
        return PacketType.objects.filter(name=row['packet'], product__name=row['product'])
